package com.asia5b.a5mall.home.adapter

import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import com.asia5b.a5mall.home.R
import com.asia5b.a5mall.middleware.model.home.CategoryModel
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * Created by zhangyuncai on 2019/12/7.
 */
class CategoryLeftAdapter(
        list: ArrayList<CategoryModel>
) : BaseQuickAdapter<CategoryModel, BaseViewHolder>(R.layout.item_categoryleft_adapter, list) {
    var selectPosition = 0;
    override fun convert(helper: BaseViewHolder, item: CategoryModel) {
        helper.setText(R.id.tv_categoryleft_menu, item.showName())
        val ll_categoryleft_vessel = helper.getView<LinearLayout>(R.id.ll_categoryleft_vessel)
        val view_categoryleft_line = helper.getView<View>(R.id.view_categoryleft_line)
        val tv_categoryleft_menu = helper.getView<TextView>(R.id.tv_categoryleft_menu)

        ll_categoryleft_vessel.isSelected = helper.layoutPosition == selectPosition
        tv_categoryleft_menu.isSelected = helper.layoutPosition == selectPosition
        view_categoryleft_line.isSelected = helper.layoutPosition == selectPosition
    }
}